package com.qfjy.controller;

import com.qfjy.common.utils.result.ResultCode;
import com.qfjy.common.utils.result.ResultJson;
import com.qfjy.entity.po.Role;
import com.qfjy.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.bytebuddy.asm.Advice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ClassName RoleController
 * @Description TODO
 * @Author guoweixin
 * @Date 2022/11/29
 * @Version 1.0
 */
@Controller
@Slf4j
@RequestMapping("role")
@Api(tags = {"角色列表"})
public class RoleController {


    @Autowired
    private RoleService roleService;

    @ResponseBody
    @GetMapping("list")
    @ApiOperation(value = "查询所有的角色状态信息")
    public Object list(){

        List<Role> list=roleService.selectListByStatus();

        if(list.size()>0){
            return new ResultJson<>(list, ResultCode.SUCCESS);
        }
        return new ResultJson<>(null,ResultCode.NOT_DATA);
    }
}
